
/** 删除 **/
function del(userID){
    // alert("--"+role)
    // 非空判断
    if(userID == '') return;
    if(confirm("您确定要删除吗？")){
        let deleteData = {
            'userId':userID,
            'role':role
        };
        let deleteResult = dataAjax('/user/delete','post',deleteData,'json');
        alert(deleteResult[0].result);
        listData();
    }else {
        return false;
    }
}

/** 批量删除 **/
function batchDel(){
    if($("input[name='IDCheck']:checked").size()<=0){
        alert("至少选择一条数据！");
        return;
    }
    // 1）取出用户选中的checkbox放入字符串传给后台,form提交
    let allIDCheck = "";
    let index = 0;
    $("input[name='IDCheck']:checked").each(function(){
            allIDCheck += $(this).val() + ",";
            index++;
    });
    // 截掉最后一个","
    if(allIDCheck.length>0) {
        allIDCheck = allIDCheck.substring(0, allIDCheck.length-1);
        // 赋给隐藏域
        $("#allIDCheck").val(allIDCheck);
        if(confirm("您确定要批量删除这"+ index +"条记录吗？")){
            let moreDeleteData = {
                'allID':allIDCheck,
                'role':role
            };
            let moreDel = dataAjax('/user/moreDelete','post',moreDeleteData,'json');
            alert(moreDel[0].result);
            if(2 == role){
                window.location.href="../../html/firmeHtml/teachUserInformation.html";
            }else if(1 == role){
                window.location.href="../../html/firmeHtml/studentUserInformation.html";
            }

            // 提交form
        }else {
            return false;
        }
    }
}